package org.jeecg.modules.openai.mapper;

import java.util.List;

import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.openai.entity.AiImgCreateRecord;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
 * @Description: 图片生成记录表
 * @Author: jeecg-boot
 * @Date:   2023-02-22
 * @Version: V1.0
 */
public interface AiImgCreateRecordMapper extends BaseMapper<AiImgCreateRecord> {

//    @Select("select a.id,IF(b.id is not null or a.score<=0 or a.score is null,a.prompt,'****') as prompt,a.imgs,a.score from ai_img_create_record a left join (select * from ai_img_payment_record where user_id=#{userId}) b on a.id = b.record_id where a.is_push=1")
//    public IPage<AiImgCreateRecord> plazaList(IPage page, @Param("userId") String userId);



    @Select("select a.id,a.msg_id,a.prompt,a.imgs,a.score,a.nick_name,a.avatar from ai_img_create_record a left join (select * from ai_img_payment_record where user_id=#{userId}) b on a.id = b.record_id where a.is_push=1 order by a.create_time desc")
    public IPage<AiImgCreateRecord> plazaList(IPage page, @Param("userId") String userId);
}
